<?php 
    session_start();

    if (!isset($_SESSION['is_logged_in'])) {
        header("Location:index.php?url=" . $_SERVER["REQUEST_URI"]);
        die();
    }
    else
    	include("php/conexion.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
	<head>
		<meta name="description" content="Torneo Comercial de Basket">
		<meta name="keywords" content="torneo.basket,comercial,amateur,vector,it,vector-it,cordoba,argentina">
		<meta name="author" content="Vector-IT">
	    <title>Torneo TCB</title>
	    <link rel="shortcut icon" href="imagenes/favicon.ico" type="image/x-icon" />
	    <link rel="icon" href="imagenes/favicon.ico" type="image/x-icon" />
		<link rel="image_src" href="http://www.torneotcb.com.ar/imagenes/logo.png" />
		<link rel="stylesheet" type="text/css" href="css/tcb.css">
	    
        <meta property="og:title" content="Torneo TCB" />
		<meta property="og:url" content="http://www.torneotcb.com.ar" />
		<meta property="og:description" content="Torneo Comercial de Basket" />
		<meta property="og:image" content="http://www.torneotcb.com.ar/imagenes/logo.png" />
		
	    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		
		<!-- Google Hosted jQuery Core -->
		<script src="http://www.google.com/jsapi"></script>
		<script>google.load("jquery", "1");</script>
		<script src="js/jquery.ez-bg-resize.js" type="text/javascript" charset="utf-8"></script>
		<script>
			$(document).ready(function() {
				
				var BGImageArray = ["bg.jpg","bg2.jpg","bg5.jpg","bg6.jpg","bg7.jpg","bg8.jpg"];
				var BGImage = BGImageArray[Math.floor(Math.random()*BGImageArray.length)];
	
				$("body").ezBgResize({
					img     : "imagenes/fondos/" + BGImage, // Relative path example.  You could also use an absolute url (http://...).
					opacity : 1, // Opacity. 1 = 100%.  This is optional.
					center  : true // Boolean (true or false). This is optional. Default is true.
				});
			});
		</script>
		<script type="text/javascript">
			function armarPagina() {
				cargarEncabezado(function(){listar();});
			}
	
			function cargarEncabezado(callback) {
	            if (window.XMLHttpRequest)
	            {// code for IE7+, Firefox, Chrome, Opera, Safari
	                xmlhttp=new XMLHttpRequest();
	            }
	            else
	            {// code for IE6, IE5
	                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	            }
	
	            xmlhttp.onreadystatechange=function()
	            {
	                if (xmlhttp.readyState==4 && xmlhttp.status==200) {
	                	document.getElementById("divEncabezado").innerHTML = xmlhttp.responseText;
	                	callback();
	                }
	            };
	            xmlhttp.open("POST","encabezado.php",true);
	            xmlhttp.send();
			}
		
		    function listar(){
		        document.getElementById("tabla").innerHTML = '<div id="actualizando"><img src="imagenes/spinner.gif" style="width: 16px; height: 16px;" />Actualizando...</div>';
		        
	            if (window.XMLHttpRequest)
	            {// code for IE7+, Firefox, Chrome, Opera, Safari
	                xmlhttp=new XMLHttpRequest();
	            }
	            else
	            {// code for IE6, IE5
	                xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	            }
	
	            xmlhttp.onreadystatechange = function()
	            {
	                if (xmlhttp.readyState==4 && xmlhttp.status==200)
	                    document.getElementById("tabla").innerHTML = xmlhttp.responseText;
	            };
	            xmlhttp.open("POST","php/partidos_listar.php",true);
	            xmlhttp.send();
		    }

		    function editar(strNumePart) {
			    location.href = "partidoON.php?NumePart=" + strNumePart;
		    }

		    function borrar(strNumePart) {
		        if (confirm("Desea borrar el partido " + strNumePart + "?")){
	                if (window.XMLHttpRequest)
	                {// code for IE7+, Firefox, Chrome, Opera, Safari
	                    xmlhttp=new XMLHttpRequest();
	                }
	                else
	                {// code for IE6, IE5
	                    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	                }
	    
	                xmlhttp.onreadystatechange=function()
	                {
	                    if (xmlhttp.readyState==4 && xmlhttp.status==200)
	                    {
	                        document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
	                        if (xmlhttp.responseText.indexOf('Correcto') > -1) {
	                        	listar();
	                        }
	                    }
	                };
	                
	                xmlhttp.open("POST","php/partidoOFF_procesar.php",true);
	                xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
	                xmlhttp.send("operacion=2&NumePart=" + strNumePart);
		        }
			}
		</script>
	</head>
	<body onload="armarPagina();">
		<?php include_once("php/analyticstracking.php") ?>
	
		<div class="contenedor">
	    	<input type="hidden" id="hdnOperacion" name="hdnValor" value="" />
			
		    <div class="encabezado" id="divEncabezado">
		    	<img src="imagenes/logo_viejo.png" />
			</div>
	    		    
	    	<div class="contenido">
	    		<input type="button" id="btnVolver" value="Volver" onclick="location.href='index.php'" class="boton" />
	    		<input type="button" id="btnArmarFecha" value="Armar Fecha" onclick="location.href='fecha.php'" class="boton" />
	    		<input type="button" id="btnPartido" value="Disputar Partido" onclick="location.href='partido.php'" class="boton" />
	    		<!-- 
	    		<input type="button" id="btnnuevoOFF" value="Nuevo OFF-Line" onclick="location.href='partidoOFF.php'" class="boton" />
	    		<input type="button" id="btnnuevoON" value="Nuevo ON-Line" onclick="location.href='partidoON.php'" class="boton" />
	    		-->
	    		<div id="txtHint"></div>
	    		
	    		<div id="tabla">
		            <div id="actualizando"><img src="imagenes/spinner.gif" style="width: 16px; height: 16px;" />Actualizando...</div>
		        </div>
		    </div>
	
		    <div id="pie" class="pie">
            	<div style="float: left;">
            		Estamos en Redes Sociales
            	  	<a href="http://www.facebook.com/pages/Torneo-Comercial-De-Basquet/126750014062523" target="_blank"><img src="imagenes/facelogo.png" height="25" width="25"  /></a>
            	  	<a href="http://twitter.com/TorneoComercial" target="_blank"><img src="imagenes/twitlogo.png" height="25" width="25" /></a>
            	</div>
                <div style="float: right;">
                	<p>
                		2013 Copyright Torneo TCB.<br/>
                		Todos los derechos reservados.<br/>
                    	Powered by <a href="http://www.vector-it.com.ar" target="_blank"><img src="imagenes/vectorit.png" height="15" width="15" />Vector-IT</a>
                    </p>
				</div>
		    </div>
		    	    
		</div>
	</body>
</html>